    package com.badboy.mapper;

    import com.badboy.entity.Users;
    import org.apache.ibatis.annotations.Mapper;
    import org.apache.ibatis.annotations.Param;
    import org.apache.ibatis.annotations.Select;

    import java.util.List;

    /**
    * @author 26607
    * @description 针对表【users(存储用户基本信息及权限标识)】的数据库操作Mapper
    * @createDate 2025-05-10 21:16:11
    * @Entity com.badboy.entity.Users
    */
    @Mapper
    public interface UsersMapper {
        @Select("SELECT * FROM users WHERE email = #{email} AND password = #{password}")
        Users findUserByEmailAndPassword(
                @Param("email") String email,
                @Param("password") String password);

        @Select("SELECT * FROM users WHERE email = #{email}")
        Users findUserByEmail(@Param("email") String email);

        @Select("SELECT * FROM users WHERE username = #{username}")
        Users findUserByUsername(@Param("username") String username);


        @Select("select * FROM users u WHERE u.user_id = #{userId}")
        Users findUserByUserId(@Param("userId") Long userId);



        int deleteByPrimaryKey(Long id);


        int insertSelective(Users record);

        Users selectByPrimaryKey(Long id);

        int updateByPrimaryKeySelective(Users record);

        int updateByPrimaryKey(Users record);

        // 新增用户
        int insert(Users user);

    }
